﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Places.master" AutoEventWireup="false" CodeFile="PlacesAlbums.aspx.vb" Inherits="PlacesAlbums" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h2>This is where all the created albums will be listed by categories</h2>
<fieldset>
<legend>Categories</legend>
    <asp:DropDownList ID="DDLCategories" runat="server" DataSourceID="DSCategories" 
        DataTextField="AlbCategory" DataValueField="ID">
    </asp:DropDownList><br />
    <asp:Button ID="btnSelect" runat="server" Text="Select" />
    <asp:SqlDataSource ID="DSCategories" runat="server" 
        ConnectionString="<%$ ConnectionStrings:myFirstDatabase %>" 
        ProviderName="<%$ ConnectionStrings:myFirstDatabase.ProviderName %>" 
        SelectCommand="SELECT * FROM [tblAlbumCategory]"></asp:SqlDataSource>
</fieldset><br />
<fieldset>
<legend>List of Albums</legend>
    <asp:GridView ID="dgAlbums" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataSourceID="DSAlbums" 
        DataKeyNames="ID">
        <Columns>
            <asp:BoundField DataField="AlbumName" HeaderText="Name" 
                SortExpression="AlbumName" />
            <asp:HyperLinkField DataNavigateUrlFields="ID" 
                DataNavigateUrlFormatString="PlacesAlbumDetails.aspx?ID={0}" DataTextField="ID" 
                HeaderText="Details" Text="Details" />
            <asp:HyperLinkField DataNavigateUrlFields="ID" DataTextField="ID" 
                HeaderText="View Album" Text="View Album" 
                DataNavigateUrlFormatString="PlacesViewPlaces.aspx?ID={0}" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="DSAlbums" runat="server" 
        ConnectionString="<%$ ConnectionStrings:myFirstDatabase %>" 
        ProviderName="<%$ ConnectionStrings:myFirstDatabase.ProviderName %>" 
        
        
        SelectCommand="SELECT [ID], [AlbumName], [AlIcon], [AlCategory] FROM [tblAlbum] WHERE ([AlCategory] = ?)">
        <SelectParameters>
            <asp:ControlParameter ControlID="DDLCategories" Name="AlCategory" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
</fieldset>
</asp:Content>

